import CryptoJS from 'crypto-js'

const key = CryptoJS.enc.Utf8.parse(import.meta.env.VITE_CACHE_CRYPTO_KEY)

//aes加密
export function aesEncrypt(str){
  return CryptoJS.AES.encrypt(str, key, {
    mode: CryptoJS.mode.ECB,
    padding: CryptoJS.pad.Pkcs7
  }).toString()
}
//aes解密
export function aesDecrypt(str){
  return CryptoJS.AES.decrypt(str, key, {
    mode: CryptoJS.mode.ECB,
    padding: CryptoJS.pad.Pkcs7
  }).toString(CryptoJS.enc.Utf8)
}
